package mh.demo.springboot;

import mh.demo.springboot.system.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

@SpringBootApplication
public class SpringbootDemoApplication implements ApplicationListener<ApplicationEvent> {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootDemoApplication.class, args);
    }

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof ApplicationReadyEvent) {
            // 获取Pid
            new PidDemo().run();
            // 访问应用程序主目录
            new ApplicationHomeDemo().run();
            // 获取Java版本
            new JavaVersionDemo().run();
            // 获取应用临时目录
            new ApplicationTempDemo().run();
            // 系统属性/环境变量访问
            new SystemEnvDemo().run();
            // 资源properties或yml加载
            new PropertySourceLoaderDemo().run();
        }
    }
}
